RED-108: Fix subreddit analyzer display#184
Merged
Merged
Conversation
- Show actual Reddit rules (was ignoring rules field from API) - Active users: show "Not available" with explanation instead of "0" - Subscribers: format as 2.0M instead of raw number - Replace "Stale hours" with "Data source" (Live vs Cached) - Replace "Restriction" with "Type" (Public/Restricted/NSFW/Quarantined) - Remove old "queued/ingest" messaging (no longer applicable) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Updates the public Subreddit analyzer UI to present clearer subreddit rules/policy and community stats, aligning the page with the tool’s intended “pre-flight check before posting” workflow.
Changes:
- Replaces the “Rule summary” card with a “Rules” view (rules list when available; policy fallback otherwise).
- Improves community stats display (compact subscriber formatting, clearer active user availability messaging, refined “Type” and “Data source” labels).
- Reorganizes secondary sections (best-time windows shown only when present; updated “What to do next” CTA copy).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
17
to
23
| policy?: { | ||
| promoAllowed: boolean; | ||
| linkPolicy: string; | ||
| promoAllowed: unknown; | ||
| linkPolicy: unknown; | ||
| flairRequired: boolean; | ||
| noLinksInPosts: boolean; | ||
| textOnly: boolean; | ||
| } | null; |
| } | ||
|
|
||
| const hasRules = (result?.rules?.length ?? 0) > 0; | ||
| const hasPolicy = result?.policy && result.policy.promoAllowed != null; |
Comment on lines
+131
to
175
| <p className="text-sm font-semibold">Rules</p> | ||
| {hasRules ? ( | ||
| <ul className="mt-4 space-y-2"> | ||
| {result!.rules!.map((rule, i) => ( | ||
| <li | ||
| key={i} | ||
| className="rounded-2xl border border-border bg-card/80 px-4 py-3 text-sm text-muted-foreground" | ||
| > | ||
| {rule} | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| ) : hasPolicy ? ( | ||
| <ul className="mt-4 space-y-2 text-sm text-muted-foreground"> | ||
| <li> | ||
| Link policy:{" "} | ||
| Promo allowed:{" "} | ||
| <span className="font-semibold text-foreground"> | ||
| {result.policy.linkPolicy} | ||
| {result!.policy!.promoAllowed ? "Yes" : "No"} | ||
| </span> | ||
| </li> | ||
| <li> | ||
| Promo allowed:{" "} | ||
| Link policy:{" "} | ||
| <span className="font-semibold text-foreground"> | ||
| {result.policy.promoAllowed ? "Yes" : "No"} | ||
| {String(result!.policy!.linkPolicy ?? "Unknown")} | ||
| </span> | ||
| </li> | ||
| <li> | ||
| Flair required:{" "} | ||
| <span className="font-semibold text-foreground"> | ||
| {result.policy.flairRequired ? "Yes" : "No"} | ||
| {result!.policy!.flairRequired ? "Yes" : "No"} | ||
| </span> | ||
| </li> | ||
| <li> | ||
| Text only:{" "} | ||
| <span className="font-semibold text-foreground"> | ||
| {result!.policy!.textOnly ? "Yes" : "No"} | ||
| </span> | ||
| </li> | ||
| </ul> | ||
| ) : ( | ||
| <p className="mt-4 text-sm text-muted-foreground"> | ||
| Analyze a subreddit to preview policy and rule signals. | ||
| {result | ||
| ? "No rules data available for this subreddit." | ||
| : "Enter a subreddit name to see its rules and posting policies."} | ||
| </p> |
| } | ||
|
|
||
| function formatNumber(n: number | null | undefined): string { | ||
| if (n == null || n === 0) return "N/A"; |
- Fix formatNumber: handle NaN/Infinity, don't treat 0 as N/A - Type policy fields properly (boolean|null, string|null instead of unknown) - Handle "fallback" source: show "Estimated (Reddit unavailable)" - Fix promoAllowed null display (show "Unknown" instead of "No") Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test Plan
🤖 Generated with Claude Code